#pragma once

#ifndef LIT__LOGGER__INCLUDED__HH__
#define LIT__LOGGER__INCLUDED__HH__

#include "LitEditorPrerequisites.h"

#include <qplaintextedit.h>
#include <qtextedit.h>
#include <qdatetime.h>
#include <qgridlayout.h>
#include <qdockwidget.h>

#include <OgreLog.h>

#include "LitInitialiser.h"

namespace Lit
{
	namespace Editor
	{
		class LIT_API Logger : public Ogre::LogListener, public Initialiser
		{
			QDockWidget *		mDock;
			QPlainTextEdit *	mEdit;
			Ogre::Log*			mLog;

			void messageLogged( const Ogre::String &msg, Ogre::LogMessageLevel lml, bool mask_debug, const Ogre::String &log_name, bool&skipThis );
		public:
			Logger( QDockWidget * dock );
			~Logger();
			
			void clear();

			RefPtr<Ogre::Log> data() const;

			QPlainTextEdit * getEditor();
			const QPlainTextEdit * getEditor() const;

			void initialise( Ogre::Log * log );
			void deInitialise();
			void logMessage( const std::string &msg, bool ogre_log_too = true );
		};
	};
};

#endif